export default function $http(options) {
	return new Promise((reolve, reject) => {
		let url = uni.$ht.config.request.url
		let config = uni.$ht.deepMerge(uni.$ht.config.request, options)
		uni.addInterceptor('request', {
			invoke(args) {
				args.url = url + args.url + '?t='+Date.now()
			},
			success(args) {
				const {data} = args
				if(data.code === 200){
					reolve(data.result)
				}else{
					reject(args)
				}
			},
			fail(err) {
				reject(err)
			}
		})
		uni.request(config)
		uni.removeInterceptor('request')
	})
}
